import instance from "./http";

export const login = (account, password) => instance.get(`/userInformation/loginIn?userAccount=${account}&userPassword=${password}`, {})

export const getUserInfo = (userNo) => instance.get(`/userInformation/queryUserInformation?userNo=${userNo}`)//获取用户账户信息

export const getUserDetail = (user_no) => instance.get(`/userDetails/queryUserDetailsByUser?user_no=${user_no}`)//获取用户个人信息

export const setUserInfo = (user) => instance.post('/userInformation/modifyUserInformation', {
    ...user
})

export const newUser = (account, password) => instance.post('/userInformation/addUserInformation', {
    userAccount: account,
    userPassword: password
})

export const getUserPosts = (userNo) => instance.get(`/post/queryUserPost?userNo=${userNo}`)//获取用户自己发的帖子

export const getUserCollections = (userNo) => instance.get(`/userCollection/queryPostCollection?user_no=${userNo}`)//获取用户收藏帖子

export const getUserSubCommunities = (userNo) => instance.get(`/userCollection/queryCommunityCollection?user_no=${userNo}`)//获取用户关注社区

export const getUserSubUsers = (user_no, user_action_type) => instance.post(`/userAction/queryUserFollow`, {
    user_no: user_no,
    user_action_type: user_action_type
})

export const followUser = (userNo, userObjectNo, userActionType) => instance.post('/userAction/UserAction', {
    userNo: userNo,
    userObjectNo: userObjectNo,
    userActionType: userActionType,
})

export const judgeFollow = (userNo, userObjectNo, userActionType) => instance.post('/userAction/JudgeUserAction', {
    userNo: userNo,
    userObjectNo: userObjectNo,
    userActionType: userActionType,
})

export const getUserNotification = (userNo) => instance.get(`/notification/selectByUser?userNo=${userNo}`)